<template>
  <NvSpin :loading="props.loading">
    <NCheckboxGroup v-bind="attrs">
      <NFlex>
        <NCheckbox v-for="item in props.dictData" :key="item.value" v-bind="item" />
      </NFlex>
    </NCheckboxGroup>
  </NvSpin>
</template>

<script lang="ts" setup>
import type { CheckboxGroupProps } from 'naive-ui'
import type { NvOption } from '@/types'
import { NCheckbox, NCheckboxGroup, NFlex } from 'naive-ui'
import { useAttrs } from 'vue'
import { NvSpin } from '@/components'

defineOptions({
  inheritAttrs: false,
})

// fix: attrs 属性不能被侦听器使用，会导致监听整个对象
const props = defineProps<{ dictData?: NvOption[], loading?: boolean }>()
const attrs = useAttrs() as CheckboxGroupProps
</script>
